package com.mezz.bones.mcp.server.service.tools;

import cn.hutool.core.date.ChineseDate;
import com.mezz.bones.mcp.server.annotation.McpTool;
import org.springframework.ai.tool.annotation.Tool;
import org.springframework.stereotype.Service;

import java.util.Date;

/**
 * 日历服务
 * @Author: zhuang
 * @Version: 1.0
 */
@Service
@McpTool(group = "calendar", description = "日历相关工具")
public class CalendarService {
    
    @Tool(description = "获取农历日期")
    public String getLunarDate() {
        ChineseDate date = new ChineseDate(new Date());
        StringBuilder result = new StringBuilder();
        
        // 添加年份和生肖
        result.append("农历").append(date.getChineseYear()).append("年");
        result.append("（").append(date.getChineseZodiac()).append("年）");
        
        // 添加月份和日期
        result.append(" ").append(date.getChineseMonthName()).append("月");
        result.append(date.getChineseDay());
        
        // 添加节气（如果有）
        String term = date.getTerm();
        if (term != null) {
            result.append(" ").append(term);
        }
        
        return result.toString();
    }
} 